﻿using SqlSugar;
using System;
using System.Collections.Generic;
//using System.ComponentModel.DataAnnotations.Schema;

namespace IdentityServer4.SqlSugarCore.Entities
{
    [SugarTable("ApiResources")]
    public class ApiResource
    {
        [SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
        public int Id { get; set; }
        //[SugarColumn(ColumnDataType = "bit")]
        public bool Enabled { get; set; } = true;
        [SugarColumn(Length = 200)]
        public string Name { get; set; }
        public string DisplayName { get; set; }
        public string Description { get; set; }
        public string AllowedAccessTokenSigningAlgorithms { get; set; }

        [SugarColumn(IsIgnore = true)]
        public List<ApiSecret> Secrets { get; set; }

        [SugarColumn(IsIgnore = true)]
        public List<ApiScope> Scopes { get; set; }

        [SugarColumn(IsIgnore = true)]
        public List<ApiResourceClaim> UserClaims { get; set; }

        [SugarColumn(IsIgnore = true)]
        public List<ApiResourceProperty> Properties { get; set; }
        public DateTime Created { get; set; } = DateTime.UtcNow;
        public DateTime? Updated { get; set; }
        public DateTime? LastAccessed { get; set; }
        public bool NonEditable { get; set; }
    }
}
